package com.hsogoo.avatar.model;

import com.hsogoo.avatar.enums.AvatarResult;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;

/**
 * @Author huangsaigang
 * Created @2018/9/29.
 */
@Data
@ToString
public class AvatarResponse extends AvatarTransporter {

    private String requestId;
    private String resultCode;
    private String resultMessage;
    private Object result;

    public void setSuccessResult(Object result){
        resultCode = AvatarResult.SUCCESS.getCode();
        this.result = result;
    }

    public boolean isSuccess(){
        return AvatarResult.SUCCESS.getCode().equals(resultCode);
    }

    public void setFailResult(String code, String message){
        this.resultCode = code;
        this.resultMessage = message;
    }

    public void setFailResult(AvatarResult avatarResult){
        this.resultCode = avatarResult.getCode();
        this.resultMessage = avatarResult.getMessage();
    }

    public void setFailResult(AvatarResult avatarResult, String reason){
        this.resultCode = avatarResult.getCode();
        this.resultMessage = reason;
    }

}
